<?php
function addCate(){
    if(insert('cate',$_POST)){
alertMsg( '添加成功','addCate.php');
    }else{
alertMsg('添加失败','addCate.php');
    }
}
function delCate($id){
    if(delete('cate',"id={$id}")){
        alertMsg('删除成功','listCate.php');
    }else{
        alertMsg('删除失败','listCate.php');
    }

}
function editCate($id){
    if(update('cate',$_POST,"id={$id}")){
         alertMsg('修改成功','listCate.php');
    }else{
        alertMsg('修改失败','listCate.php');
    }
}

function getAllCate($page,$pagesize){
    $offset=($page-1)*$pagesize;
    $sql="select * from cate limit $offset,$pagesize";
    return fetchall($sql);
}

function getTotalCatePage(){
    return getresnum('select * from cate');
}
function getallgoodcate(){
    return fetchall('select * from cate ');
}




